﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _118_Linq学习
{
    class Program
    {
        static void Main(string[] args)
        {
            PersonInfo worker1 = new PersonInfo
            {
                Age = 21,
                Name = "赵一",
                Device = new DeviceInfo()
                {
                    Id = 1,
                    DeviceName = "安全帽"
                }
            };
            PersonInfo worker2 = new PersonInfo
            {
                Age = 22,
                Name = "赵二",
                Device = new DeviceInfo()
                {
                    Id = 2,
                    DeviceName = "安全帽"
                }
            };
            List<PersonInfo> persons = new List<PersonInfo>();
            persons.Add(worker1);
            persons.Add(worker2);


            PersonInfo worker2_same = new PersonInfo   //工人2的所有数据相同
            {
                Age = 22,
                Name = "赵二",
                Device = new DeviceInfo()
                {
                    Id = 2,
                    DeviceName = "安全帽"
                }
            };
            PersonInfo worker2_quotation = worker2;   //工人2的引用

            if (persons.Contains(worker2_quotation))
            {
                Console.WriteLine("Contains函数，包含引用就返回成功！");  //结论是引用
            }
            if (persons.Contains(worker2_same))
            {
                Console.WriteLine("Contains函数，包含相同数据成功！");
            }
            Console.ReadKey();
        }
    }
}
